Skip to content

Disable in Vim compatible mode. Add a global to detect if loaded.#8

Merged
eapache merged 1 commit intoeapache:masterfrom
robert-claypool:master
Oct 18, 2017
Merged

Disable in Vim compatible mode. Add a global to detect if loaded.#8
eapache merged 1 commit intoeapache:masterfrom
robert-claypool:master

Conversation

@robert-claypool
Copy link
Copy Markdown

  1. Disable this plugin if 'compatible' is set.
  2. Add a global to detect the presence of this plugin.

I use g:loaded_rainbow_parentheses in .vimrc like so:

function! SetupPlugins()
    if exists('g:loaded_rainbow_parentheses')
        echom "Configuring Rainbow Parentheses..."
        autocmd FileType json,javascript,css,html RainbowParenthesesActivate
        autocmd Syntax javascript RainbowParenthesesLoadRound
        autocmd Syntax json,javascript RainbowParenthesesLoadSquare
        autocmd Syntax json,javascript,css RainbowParenthesesLoadBraces
        autocmd Syntax html RainbowParenthesesLoadChevrons
    endif
endfunction

" Plugins are loaded after Vim has finished processing .vimrc,
" so we test for their existence and configure them on VimEnter.
autocmd VimEnter * call SetupPlugins()

This change is consistent with tpope plugins, for example see https://github.com/tpope/vim-fugitive/blob/master/plugin/fugitive.vim#L6

@eapache
Copy link
Copy Markdown
Owner

eapache commented Oct 18, 2017

Thanks!

@eapache eapache merged commit 7a67652 into eapache:master Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants